{include file="public/layout.htm" /}
<body class="">
    <div class="ey-content back-c">
        <div class="form-title">留言详情</div>
        <div class="block-form">
            {foreach name="attr_list" item="vo" key="k" }
            <div class="form-cell">
                <div class="tit"><span>{$vo.attr_name}：</span></div>
                <div class="box">{$vo.attr_value}</div>
            </div>
            {/foreach}
            <div class="form-cell">
                <div class="tit"><span>所属表单：</span></div>
                <div class="box">{$row.form_name|default=''}</div>
            </div>
            <div class="form-cell">
                <div class="tit"><span>IP来源：</span></div>
                <div class="box">{$row.ip} &nbsp; {notempty name='$row.city'}({$row.city}){else /}(<a href="https://www.baidu.com/s?wd={$row.ip}" target="_blank">查看地区</a>){/notempty}</div>
            </div>
            <div class="form-cell">
                <div class="tit"><span>提交来源：</span></div>
                <div class="box">{if condition="$row['source'] == 2"}手机端{else /}电脑端{/if}</div>
            </div>
            <div class="form-cell">
                <div class="tit"><span>提交时间：</span></div>
                <div class="box">{$row.add_time|MyDate='Y-m-d H:i:s',###}</div>
            </div>
            <div class="form-cell">
                <div class="tit"><span>查看时间：</span></div>
                <div class="box">{$row.update_time|MyDate='Y-m-d H:i:s',###}</div>
            </div>
        </div>
        <div class="placeholder-height"></div>
        <div class="footer-wrap">
            <div class="container">
                {eq name="$row.is_star" value="0"}
                <button class="on" onclick="ajaxSetStar(this);" data-aid="{$row.aid}" data-star='1'>设为星标</button>
                {else/}
                <button class="on" onclick="ajaxSetStar(this);" data-aid="{$row.aid}" data-star='0'>取消星标</button>
                {/eq}
                <button class="nt" onclick="unifiedJump(this);" data-url="{:weapp_url('Mbackend/Form/index')}">关闭</button>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        function ajaxSetStar(obj) {
            var aid = $(obj).attr('data-aid');
            var star = $(obj).attr('data-star');
            $.ajax({
                type : 'post',
                url : "{:url('Guestbook/ajax_set_star')}",
                data : {_ajax: 1, weappAjax: 1, aid: aid, is_star: star},
                dataType : 'json',
                success : function(res) {
                    if (res.code == 1) {
                        if (star == 1) {
                            $(obj).html('取消星标');
                            $(obj).attr('data-star', '0');
                        } else {
                            $(obj).html('设为星标');
                            $(obj).attr('data-star', '1');
                        }
                        layerMsg(res.msg, 1);
                    } else {
                        layerAlert(res.msg, '确认');
                    }
                }
            });
        }
    </script>
</body>
{include file="public/footer.htm" /}